<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

use Gregwar\Captcha\CaptchaBuilder;
use Session;
class CaptchaController extends Controller
{
    public function get_captcha($tmp)
    {
        $captch=new CaptchaBuilder();
        $captch->build(120,40);
        // 设置背景颜色
        $captch->setMaxAngle(25);
        $captch->setMaxBehindLines(0);
        $captch->setMaxFrontLines(0);
        //或者验证码内容
        $phrase=$captch->getPhrase();
        //内容存储到session
        Session::flash("microcaptcha",$phrase);
        ob_clean();//清除缓存
        return response($captch->output())->header('Content-type','image/jpeg'); //把验证码数据以jpeg图片的格式输出
    }
}
